<%@include file="/header.jsp" %>
<%@page import="entity.ProductAvailability"%>
<c:url value="/CategoryList" var="categoryListUrl" />
<c:url value="/ProductList" var="categoryUrl">
    <c:param name="category_id" value="${product.category.id}" />
</c:url>
<c:url value="/ShowImage" var="imageUrl">
    <c:param name="id" value="${product.image.id}" />
</c:url>


<div id="breadcrump">
    <ul id="breadcrump-list">
        <li>&raquo; <a href="${categoryListUrl}">Catalogus</a></li>
        <li>&raquo; <a href="${categoryUrl}">${product.category.name}</a></li>
        <li>&raquo; ${product.name}</li>
    </ul>
</div>
<table border="1">
    <tr>
        <td colspan="2"><img src="${imageUrl}"></td>
    </tr>
    <tr>
        <td>Naam:</td><td>${fn:escapeXml(product.name)}</td>
    </tr>
    <tr>
        <td>Prijs:</td><td>${product.price}</td>
    </tr>
    <tr>
        <td>Beschrijving:</td><td>${product.description}</td>
    </tr>
    <tr>
        <td>Naam:</td><td>${product.availability}</td>
    </tr>
    <c:choose>
        <c:when test="${product.availability != 'UNAVAILABLE'}">
            <c:url var="addToCartUrl" value="/customer/AddToCart">
                <c:param name="product_id" value="${product.id}" />
            </c:url>
            
            <form method="post" action="${addToCartUrl}">
                <tr>
                    <td>Aantal</td>
                    <td><input type="text" name="quantity" value="${fn:escapeXml(1)}" maxlength="3"></td>
                </tr>
                <tr>
                    <td></td>
                    <td><input type="submit" value="Toevoegen"></td>
                </tr>
            </form>
        </c:when>
    </c:choose>
</table>

<%@include file="/footer.jsp" %>